## ==============helm 安装 docke 镜像源修改 ============

export namespace="argoproj-system"
export app_name="argo-workflows"
export repo="argoproj"
export helm="$repo/$app_name"
export url="https://argoproj.github.io/argo-helm"
# export argocdtag=$(wget -qO- -t1 -T2 "https://api.github.com/repos/argoproj/argo-cd/releases/latest" | jq -r '.tag_name')
# export tag="v2.6.0-rc2" #v2.6.0-rc2 latest

# helm repo remove $repo
helm repo add $repo $url
helm repo update $repo

helm upgrade --create-namespace --install \
    -n $namespace $app_name $helm \
    -f values.yaml

# export ARGO_WORKFLOWS_VERSION=$(wget -qO- -t1 -T2 "https://api.github.com/repos/argoproj/argo-workflows/releases/latest" | jq -r '.tag_name')
# echo "ARGO_WORKFLOWS_VERSION: ${ARGO_WORKFLOWS_VERSION}"
# kubectl apply -n ${namespace} -f "https://github.com/argoproj/argo-workflows/releases/download/${ARGO_WORKFLOWS_VERSION}/quick-start-minimal.yaml"

# export argocdtag=$(wget -qO- -t1 -T2 "https://api.github.com/repos/argoproj/argo-cd/releases/latest" | jq -r '.tag_name')
# echo "argocdtag: ${argocdtag}"
# kubectl apply -n ${} -f https://ghproxy.net/https://raw.githubusercontent.com/argoproj/argo-cd/refs/heads/master/manifests/install.yaml

## 编辑 argocd-server Deployment 以将 --insecure 标志添加到 argocd-server 命令中
# containers:
#         - name: server
#           image: argoproj/argocd:v2.5.0
#           args:
#             - /usr/local/bin/argocd-server
#             - '--insecure'

# env:
#   - name: TZ
#     value: "Asia/Shanghai"

#获取管理员密码
# kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d

# argocdcli 添加多集群管理
# pacman -S argocd

#高可用性安装
# kubectl create namespace argocd
# kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/v2.6.0-rc6/manifests/ha/install.yaml
# kubectl apply -f ./cloud-devops/argocd/ingress-argocd.yaml
